#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
@Project ：Employment_class 
@File    ：07_TCP服务器.py
@IDE     ：PyCharm 
@Author  ：XiaoDengYa
@Date    ：2021/7/5/005 15:46 
"""

from socket import *

tcpSocket = socket(AF_INET, SOCK_STREAM)

address = ("", 7788)

tcpSocket.bind(address)

tcpSocket.listen(5)

newSocket, clinetAddr = tcpSocket.accept()

recvData = newSocket.recv(1024)
print("接收到数据：{}".format(recvData.decode("gb2312")))

newSocket.send("测试一下啦".encode("utf-8"))

newSocket.close()

tcpSocket.close()
